package com.jokul.connection;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;



/**
 *@author: jokul
 *@2013-2-26 上午10:21:14
 */

public class DataBase {

	
	public static Connection getConnection() throws SQLException {
		Connection connection = null ;
		try {
			Context initialContext = new InitialContext();
			DataSource dataSource = (DataSource) initialContext
					.lookup("java:/comp/env/picture");
			connection = dataSource.getConnection();
		} catch (NamingException e) {
			e.printStackTrace();
		}
		return connection;
	}
	
}
